// This file was decompiled using SASCM.ini published by GTAG (http://gtag.gtagaming.com/opcode-database) on 14.6.2013
{$CLEO .CS}

//-------------MAIN---------------
thread 'HBAL2' 

while true
    wait 0
    28@ = false                                                                                                                                                                                                        
    #patriot.Load                                                                                                                                                                                                     
    #ballas3.load
    #ballas2.load    
    #ballas1.load                                                                                                                                                                                                             
    #mp5lng.load                                                                                                                                                                                                       
    038b:                                                                                                                                                                                                              
    while true                                                                                                                                                                                                         
    repeat                                                                                                                                                                                                             
    wait 0                                                                                                                                                                                                             
    until if player.Defined(0)                                                                                                                                                                                         
    09E8: $GYMFIGHT_INTERIOR = actor $PLAYER_ACTOR active_interior                                                                                                                                                     
    if $GYMFIGHT_INTERIOR == 0                                                                                                                                                                                        
    then                                                                                                                                                                                                               
        if 28@ == false                                                                                                                                                                                                
        then                                                                                                                                                                                                      
            0208: 6@ = random_float_in_ranges 50.2 100.2                                                                                                                                                               
            0208: 7@ = random_float_in_ranges 50.2 100.2                                                                                                                                                               
            04C4: store_coords_to 0@ 1@ 2@ from_actor $PLAYER_ACTOR with_offset 6@ 7@ -1.0                                                                                                                             
            04D3: get_nearest_car_path_coords_from 0@ 1@ 2@ type 0 store_to 6@ 7@ 8@                                                                                                                                   
            3@ = car.Create(#patriot,6@,7@,8@)                                                                                                                                                                        
            Car.Angle(3@) = 184.7214                                                                                                                                                                                   
            Car.SetMaxSpeed(3@, 253.0)                                                                                                                                                                                 
            Car.DoorStatus(3@) = 5                                                                                                                                                                                     
            car.Health(3@) = 10000                                                                                                                                                                                     
            00AE: set_car 3@ traffic_behaviour_to 2                                                                                                                                                                    
            Car.SetDriverBehaviour(3@, drivetoplayer)                                                                                                                                                                  
            053F: set_car 3@ tires_vulnerability 0                                                                                                                                                                     
            01EC: make_car 3@ very_heavy 1                                                                                                                                                                             
            Car.SetImmunities(3@, 0, 1, 0, 1, 1)                                                                                                                                                                       
            //5@ = marker.CreateAboveCar(3@)                                                                                                                                                                           
            0587: enable_car 3@ validate_position 0                                                                                                                                                                    
            7@ = Actor.CreateAsDriver(gang1, #ballas3, 3@)                                                                                                                                                                  
            8@ = Actor.CreateAsPassenger(gang1, #ballas1, 3@, 0)
            4@ = Actor.CreateAsPassenger(gang1, #ballas2, 3@, 1)
            15@ = Actor.CreateAsPassenger(gang1, #ballas3, 3@, 2)
            0446: set_actor 8@ dismemberment_possible 0
            0446: set_actor 7@ dismemberment_possible 0
            0446: set_actor 4@ dismemberment_possible 0
            0446: set_actor 15@ dismemberment_possible 0
            Actor.Health(7@) = 1000     
            Actor.Health(8@) = 1000     
            Actor.Health(4@) = 1000     
            Actor.Health(15@) = 1000     
            
                                                                                                                                                                        
            24@ = actor.Create(gang1, #ballas3, 6@,7@,8@)                                                                                                                                                                   
            Actor.SetImmunities(24@, 0, 0, 0, 0, 0)
            Actor.Health(24@) = 1000                                                                                                                                                                       
            0619: enable_actor 24@ collision_detection 0                                                                                                                                                               
            27@ = Object.Create(2985, 0.0, 0.0, -25.0)                                                                                                                                                                 
            Object.CollisionDetection(27@) = False                                                                                                                                                                     
            0400: store_coords_to 0@ 1@ 2@ from_actor 27@ with_offset 0.0 2.0 1.1                                                                                                                                      
            Object.PutAt(27@, 0@ 1@ 2@)                                                                                                                                                                                
            0681: attach_object 27@ to_car 3@ with_offset 0.0 -1.0 0.5 rotation 0.0 0.0 0.0                                                                                                                            
            06A7: put_actor 24@ into_turret_on_car 3@ at_car_offset 0.0 -1.5 1.2 position 1 shooting_angle 100.0 360.0 with_weapon 0                                                                                   
            0638: AS_actor 24@ stay_put 1                                                                                                                                                                              
            04F4: put_actor 24@ into_turret_on_object 27@ offset_from_object_origin -0.5 0.0 0.7 orientation 0 both_side_angle_limit 360.0 lock_weapon 0                                                                                                                                                                                                                            
            072F: enable_car 3@ stuck_check_distance 0.5 time 4000 and_restore_if stuck 1 flipped 1 unk_place_on_road_properly 1 to_path 7 // extended 03CC                                                                                                                 
            0190: add_car 3@ to_flipped_check // 6 max                                                                                                                                                                                                         
            Car.SetDriverBehaviour(3@, drivetoplayer)
            0978: copy_decision_maker 65540 to 22@ 
            0709: set_decision_maker 22@ on_event 36 taskID 1022 respect 0.0 hate 100.0 like 0.0 dislike 0.0 in_car 1 on_foot 0 // see *.ped files 
            0709: set_decision_maker 22@ on_event 37 taskID 1022 respect 0.0 hate 100.0 like 0.0 dislike 0.0 in_car 1 on_foot 0 // see *.ped files 
            0709: set_decision_maker 22@ on_event 36 taskID 1024 respect 0.0 hate 50.0 like 0.0 dislike 0.0 in_car 0 on_foot 1 // see *.ped files 
            060B: set_actor 8@ decision_maker_to 22@
            060B: set_actor 4@ decision_maker_to 22@ 
            060B: set_actor 15@ decision_maker_to 22@
            for 6@ = 0 to 22 step 1
                if and
                    //not 6@ == 0
                    not 6@ == 7
                     not 6@ == 4
                      not 6@ == 5
                jf continue 
                077A: set_actor 8@ acquaintance 4 to_actors_pedtype 6@ // see ped.dat          
                077A: set_actor 4@ acquaintance 4 to_actors_pedtype 6@ // see ped.dat    
                077A: set_actor 15@ acquaintance 4 to_actors_pedtype 6@ // see ped.dat    
            end
            if 056D:   actor 7@ defined                                                                                                                                                                                
            then                                                                                                                                                                                                       
                if not Actor.HasWeapon(7@, 29)                                                                                                                                                                         
                then Actor.GiveWeaponAndAmmo(7@, 29, 999999)                                                                                                                                                           
                end                                                                                                                                                                                                    
            end                                                                                                                                                                                                        
            if 056D:   actor 8@ defined                                                                                                                                                                                
            then                                                                                                                                                                                                       
                if not Actor.HasWeapon(8@, 29)                                                                                                                                                                         
                then Actor.GiveWeaponAndAmmo(8@, 29, 999999)                                                                                                                                                           
                end                                                                                                                                                                                                    
            end
            if 056D:   actor 4@ defined                                                                                                                                                                                
            then                                                                                                                                                                                                       
                if not Actor.HasWeapon(4@, 29)                                                                                                                                                                         
                then Actor.GiveWeaponAndAmmo(4@, 29, 999999)                                                                                                                                                           
                end                                                                                                                                                                                                    
            end                 
            if 056D:   actor 15@ defined                                                                                                                                                                                
            then                                                                                                                                                                                                       
                if not Actor.HasWeapon(15@, 29)                                                                                                                                                                         
                then Actor.GiveWeaponAndAmmo(15@, 29, 999999)                                                                                                                                                           
                end                                                                                                                                                                                                    
            end                                                                                                                                                                                                                         
            28@ = true                                                                                                                                                                                                 
            21@ = 1                                                                                                                                                                                                   
        end                                                                                                                                                                                                            
        if 28@ == true                                                                                                                                                                                                 
        then                                                                                                                                                                                                           
            if 056E:   car 3@ defined                                                                                                                                                                                  
            then                                                                                                                                                                                                       
                if 056D:   actor 24@ defined                                                                                                                                                                          
                then 
                    if not Actor.Animation(24@) == "DRIVE_R_SLOW"
                    then 0812: AS_actor 24@ perform_animation "DRIVE_R_SLOW" "ped" framedelta 4.0 loop 1 lockX 0 lockY 0 lockF 0 time -1                                                                                                                                                                                                                       
                    end
                    if 01F4:   car 3@ flipped                                                                                                                                                                          
                    then car.Angle(3@) = 0.0                                                                                                                                                                            
                    end                                                                                                                                                                                                
                    if 03ca:   actor 27@ defined                                                                                                                                                                       
                    then object.StorePos(27@, 26@, 25@, 23@)                                                                                                                                                            
                    end                                                                                                                                                                                                
                    gosub @get_criminal                                                                                                                                                                                
                    if 056D:   actor 31@ defined                                                                                                                                                                       
                    then                                                                                                                                                                                               
                        if not actor.Dead(31@)                                                                                                                                                                         
                        jf @sssg                                                                                                                                                                                                 
                        Actor.StorePos(31@, 10@, 20@, 2@)
                        :sssg
                    else Actor.StorePos($PLAYER_ACTOR, 10@, 20@, 2@)
                    end                                                                                                                                                             
                    050A: 1@ = distance_between_XYZ 26@ 25@ 23@ and_XYZ 10@ 20@ 2@                                                                                                                                 
                    0087: 13@ = 2@ // (float)                                                                                                                                                                       
                    0063: 13@ -= 23@ // (float)                                                                                                                                                                     
                    0073: 13@ /= 1@ // (float) = sin                                                                                                                                                                
                    0087: 14@ = 13@ // (float)                                                                                                                                                                       
                    0087: 30@ = 13@ // (float)                                                                                                                                                                      
                    006B: 13@ *= 14@ // (float)                                                                                                                                                                      
                    006B: 13@ *= 14@ // (float)                                                                                                                                                                      
                    13@ /= 6.0                                                                                                                                                                                      
                    005B: 30@ += 13@ // (float)                                                                                                                                                                     
                    13@ *= 6.0                                                                                                                                                                                      
                    006B: 13@ *= 14@ // (float)                                                                                                                                                                      
                    006B: 13@ *= 14@ // (float)                                                                                                                                                                      
                    13@ *= 0.075                                                                                                                                                                                    
                    005B: 30@ += 13@ // (float)                                                                                                                                                                     
                    13@ /= 0.075                                                                                                                                                                                    
                    006B: 13@ *= 14@ // (float)                                                                                                                                                                      
                    006B: 13@ *= 14@ // (float)                                                                                                                                                                      
                    13@ *= 0.0446                                                                                                                                                                                   
                    005B: 30@ += 13@ // (float)  arcsinX = X + (X^3)/6 + (X^5)*3/40 + (X^7)*15/336                                                                                                                  
                    30@ *= -57.296 //                                                                                                                                                      
                    30@ += 350.0                                                                                                                                                                                   
                    0063: 10@ -= 26@ // (float)                                                                                                                                                                    
                    0063: 20@ -= 25@ // (float)                                                                                                                                                                    
                    0604: get_Z_angle_for_point 10@ 20@ store_to 11@  // 1  - x2-x1   2  - y2-y1                                                                                                   
                    //-----------------------------------------------------------    X  Y                                                                                                  
                    0174: 12@ = car 3@ Z_angle                                                                                                                                                                     
                    0063: 11@ -= 12@ // (float)                                                                                                                                                                    
                    11@ += 270.0   //                                                                                                                            
                    02F6: 10@ = cosine 11@ // (float)                                                                                                                                                         
                    02F7: 20@ = sine 11@ // (float)                                                                                                                                                         
                    10@ *= -0.3                                                                                                                                                                                    
                    20@ *= 0.4                                                                                                                                                                                     
                    //-----------------------------------------------------------                                                                                                                
                    11@ -= 180.0                                                                                                                                                                                   
                    if 30@ < 320.0                                                                                                                                                                                 
                    then 30@ = 320.0                                                                                                                                                                               
                    end                                                                                                                                                                                            
                    if 30@ > 395.0                                                                                                                                                                                 
                    then 30@ = 395.0                                                                                                                                                                               
                    end                                                                                                                                                                                            
                    if and                                                                                                                                                                                         
                    0471:   actor 24@ near_object_in_rectangle 27@ radius 2.0 2.0 sphere 0                                                                                                                         
                    03ca:   actor 27@ defined                                                                                                                                                                      
                    then //0acd: "000" 100
                        0087: 19@ = 30@
                        19@ += 10.0                                                                                                                                                                         
                        0681: attach_object 27@ to_car 3@ with_offset 0.0 -1.0 0.5 rotation 0.0 19@ 11@                                                                                                            
                        11@ = object.Angle(27@)                                                                                                                                                                    
                        11@ -= 94.0                                                                                                                                                                                
                        actor.Angle(24@) = 11@                                                                                                                                                                     
                        if not Actor.Animation(24@) == "DRIVE_R_SLOW"
                        then 0812: AS_actor 24@ perform_animation "DRIVE_R_SLOW" "ped" framedelta 4.0 loop 1 lockX 0 lockY 0 lockF 0 time -1                                                                                                                                                                                                                       
                        end                                                                                                                                                                      
                        if and
                            21@ == 2
                            86BD:   not no_obstacles_between 10@ 20@ 2@ and 26@ 25@ 23@ solid 1 car 0 actor 0 object 0 particle 0 
                                                                                                                                                                               
                        then 
                            if 056D:   actor 31@ defined                                                                                                                                                                       
                            then                                                                                                                                                                                   
                                if not actor.Dead(31@)                                                                                                                                                             
                                then               
                                    0393: actor 24@ perform_animation "DRIVE_R_SLOW" at 1.0 times_normal_rate                                                                                          
                                    0208: 5@ = random_float_in_ranges -1.0 1.0                                                                                                                                                                                                            
                                    0208: 6@ = random_float_in_ranges -1.0 1.0                                                                                                                                     
                                    0400: store_coords_to 26@ 25@ 18@ from_car 27@ with_offset 0.8 0.0  1.1                                                                                                        
                                    04C4: store_coords_to 10@ 20@ 23@ from_car 31@ with_offset 5@ 0.0 6@                                                                                               
                                    06BC: create_M4_shoot_from 26@ 25@ 18@ target 10@ 20@ 23@ energy 100                                                                                               
                                    066E: create_particle "GUNFLASH" attached_to_object 27@ with_offset 0.8 0.0  1.1 rotation  0.866024961519 0 0.500000766025 flag 1 handle_as 0@                                 
                                    064C: make_particle 0@ visible                                                                                                                                                 
                                    064F: remove_references_to_particle 0@                                                                                                                                         
                                    097B: play_audio_at_object 27@ event 1157                                                                                                                          
                                else 14@ = false
                                end
                            else 14@ = false
                                    0393: actor 24@ perform_animation "DRIVE_R_SLOW" at 1.0 times_normal_rate                                                                                          
                                    0208: 5@ = random_float_in_ranges -1.0 1.0                                                                                                                                                                                                            
                                    0208: 6@ = random_float_in_ranges -1.0 1.0                                                                                                                                     
                                    0400: store_coords_to 26@ 25@ 18@ from_car 27@ with_offset 0.8 0.0  1.1                                                                                                        
                                    04C4: store_coords_to 10@ 20@ 23@ from_car $PLAYER_ACTOR with_offset 5@ 0.0 6@                                                                                               
                                    06BC: create_M4_shoot_from 26@ 25@ 18@ target 10@ 20@ 23@ energy 100                                                                                               
                                    066E: create_particle "GUNFLASH" attached_to_object 27@ with_offset 0.8 0.0  1.1 rotation  0.866024961519 0 0.500000766025 flag 1 handle_as 0@                                 
                                    064C: make_particle 0@ visible                                                                                                                                                 
                                    064F: remove_references_to_particle 0@                                                                                                                                         
                                    097B: play_audio_at_object 27@ event 1157             
                            end            
                        end                                                                                                                                                                                        
                        IF 21@ == 1                                                                                                                                                                               
                        THEN //0acd: "firing" 100                                                                                                                                                                                    
                            IF NOT 9@ >= 50                                                                                                                                                                      
                            THEN 9@ += 1                                                                                                                                                                         
                            ELSE 21@ = 2                                                                                                                                                                          
                            END                                                                                                                                                                                    
                        END                                                                                                                                                                                        
                        IF 21@ == 2                                                                                                                                                                               
                        THEN //0acd: "wait" 100   
                            0393: actor 24@ perform_animation "DRIVE_R_SLOW" at 0.0 times_normal_rate                                                                                                                                                                                            
                            IF 9@ > 0                                                                                                                                                                            
                            THEN 9@ -= 1                                                                                                                                                                         
                            end                                                                                                                                                                                    
                        END                                                                                                                                                                                        
                        IF 9@ == 1                                                                                                                                                                               
                        THEN 21@ = 1                                                                                                                                                                              
                        END                                                                                                                                                                                        
                    end                                                                                                                                                                                            
                end
                0AB4: 16@ < 439                                                                                                                                                                                                   
                if or                                                                                                                                                                                                  
                    8202:   not actor $PLAYER_ACTOR near_car 3@ radius 200.0 200.0 sphere 0                                                                                                                            
                    car.Wrecked(3@)
                    16@ == TRUE                                                                                                                                                                                    
                then
                    goto @clean_ballas
                end                                                                                                                                                                                                    
            end                                                                                                                                                                                                        
            if not actor.Dead(8@)                                                                                                                                                                                      
            then                                                                                                                                                                                                       
                else if 056D:   actor 8@ defined                                                                                                                                                                       
                then Actor.RemoveReferences(8@)                                                                                                                                                                        
                end                                                                                                                                                                                                    
            else                                                                                                                                                                                                        
                if not actor.Dead(7@)                                                                                                                                                                                  
                then                                                                                                                                                                                                   
                    else if 056D:   actor 7@ defined                                                                                                                                                                   
                    then Actor.RemoveReferences(7@)                                                                                                                                                                    
                    end                                                                                                                                                                                                
                else                                                                                                                                                                                                   
                    if not actor.Dead(24@)                                                                                                                                                                             
                    then                                                                                                                                                                                               
                        else if 056D:   actor 24@ defined                                                                                                                                                              
                        then //0465: remove_actor 24@ from_turret_mode 

                            Actor.RemoveReferences(24@)                                                                                                                                                               
                        end                                                                                                                                                                                            
                    else                                                
                        if not actor.Dead(4@)                                                                                                                                                                         
                        then                                                                                                                                                                                           
                            else if 056D:   actor 4@ defined                                                                                                                                                          
                            then Actor.RemoveReferences(4@)                                                                                                                                                           
                            end                                                                                                                                                                                        
                        else                                                     
                            if not actor.Dead(15@)                                                                                                                                                                     
                            then                                                                                                                                                                                       
                                else if 056D:   actor 15@ defined                                                                                                                                                      
                                then Actor.RemoveReferences(15@)                                                                                                                                                       
                                end                                                                                                                                                                                    
                            end
                        end
                    end
                end
            end                                                                                                                                                                                                       
        end                                                                                                                                                                                                            
    end                                                                                                                                                                                                                
end

:get_criminal
if or
   14@ == false
   33@ >= 5000
then 33@ = 0
    Actor.StorePos($PLAYER_ACTOR, 0@, 1@, 2@)                                                                            
    if 0AE1: 31@ = random_actor_near_point 0@ 1@ 2@ in_radius 200.0 find_next 1 pass_deads 0 //IF and SET                
    then                                                                                                                                                              
        IF NOT 31@ == -1                                                                                                                                               
        then                                                                                                                                        
            IF 056D:   actor 31@ defined                                                                                                                               
            then                                                                                                         
                089F: get_actor 31@ pedtype_to 13@ 
                if or
                    13@ == 8
                    13@ == 6
                    13@ == 0
                then 14@ = true
                else 
                    31@ = -1
                    14@ = false
                end                                                                                          
            end                                                                                                          
        end                                                                                                              
    end                                                                                                                  
end
return

:clean_ballas                                                                                                                                                                                        
    if 056E:   car 3@ defined                                                                                                                                                                          
    then car.RemoveReferences(3@)                                                                                                                                                                      
    end                                                                                                                                                                                                
    if 056D:   actor 7@ defined                                                                                                                                                                        
    then Actor.RemoveReferences(7@)                                                                                                                                                                    
    end                                                                                                                                                                                                
    if 056D:   actor 8@ defined                                                                                                                                                                        
    then Actor.RemoveReferences(8@)                                                                                                                                                                    
    end
    if 056D:   actor 4@ defined                                                                                                                                                                        
    then Actor.RemoveReferences(4@)                                                                                                                                                                    
    end                                                                                                                                                                                                
    if 056D:   actor 15@ defined                                                                                                                                                                        
    then Actor.RemoveReferences(15@)                                                                                                                                                                    
    end                                                                                                                                                                                                                                               
    if 056D:   actor 24@ defined                                                                                                                                                                       
    then 
        if not actor.dead(24@)
        then 0465: remove_actor 24@ from_turret_mode
        end 
        Actor.RemoveReferences(24@)                                                                                                                                                                   
    end                                                                                                                                                                                                      
    IF 03CA:   object 27@ exists                                                                                                                                                                       
    THEN object.RemoveReferences(27@)                                                                                                                                                                  
    END                                                                                                                                                                                                
end_thread                      